﻿@using Csla.Web.Mvc
@using ProjectTracker.Library

@model IEnumerable<ProjectTracker.Library.ResourceInfo>

@{
    ViewBag.Title = "Resources";
}

<h2>@ViewBag.Title</h2>

<p>
   @Html.HasPermission(Csla.Rules.AuthorizationActions.CreateObject, typeof(ResourceEdit), Html.ActionLink("Create New", "Create"), string.Empty)
</p>
<table>
    <tr>
        <th></th>
        <th>
            Name
        </th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.HasPermission(Csla.Rules.AuthorizationActions.EditObject, typeof(ResourceEdit), Html.ActionLink("Edit", "Edit", new { id = item.Id }), "Edit") |
            @Html.ActionLink("Details", "Details", new { id=item.Id }) |
            @Html.HasPermission(Csla.Rules.AuthorizationActions.DeleteObject, typeof(ResourceEdit), Html.ActionLink("Delete", "Delete", new { id = item.Id }), "Delete")
        </td>
        <td>
            @item.Name
        </td>
    </tr>
}

</table>

